package day0920_1;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
public class T4 {
    public static void main(String[] args) {
        Map<Integer,String>  map=new TreeMap();
        map.put(1001,"刘景荣");//1.
        map.put(1002,"蒋建伟");
        map.put(1003,"贺世杰");
        //2. entrySet取出三个键值对//1001-刘景荣    1002-蒋建伟   1003-贺世杰
        Set<Map.Entry<Integer, String>> entrySet=map.entrySet();
        //  获取了三个Entry对象<左边key的类型是整数，vlaue的类型时String>
        Iterator ite=entrySet.iterator();//A.
        while(ite.hasNext()){//B.
            Map.Entry<Integer, String> ele=(Map.Entry<Integer, String>)ite.next();//C.
            System.out.println("ele = " + ele);
        }



    }
}


